<% layout('/layouts/default.html', {title: '客户档案管理', libs: ['dataGrid']}){ %>
<div class="main-content">
	<div class="box box-main">
		<div class="box-header">
			<div class="box-title">
				<i class="fa icon-notebook"></i> ${text('客户档案管理')}
			</div>
			<div class="box-tools pull-right">
				<a href="#" class="btn btn-default" id="btnSearch" title="${text('查询')}"><i class="fa fa-filter"></i> ${text('查询')}</a>
				<% if(hasPermi('st:stCustomRecord:edit')){ %>
					<a href="${ctx}/st/stCustomRecord/form" class="btn btn-default btnTool" title="${text('新增客户档案')}"><i class="fa fa-plus"></i> ${text('新增')}</a>
				<% } %>
				<a href="#" class="btn btn-default" id="btnSetting" title="${text('设置')}"><i class="fa fa-navicon"></i></a>
			</div>
		</div>
		<div class="box-body">
			<#form:form id="searchForm" model="${stCustomRecord}" action="${ctx}/st/stCustomRecord/listData" method="post" class="form-inline hide"
					data-page-no="${parameter.pageNo}" data-page-size="${parameter.pageSize}" data-order-by="${parameter.orderBy}">
				<div class="form-group">
					<label class="control-label">${text('客户编号')}：</label>
					<div class="control-inline">
						<#form:input path="customCode" maxlength="20" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('全称')}：</label>
					<div class="control-inline">
						<#form:input path="companyFullName" maxlength="20" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('简称')}：</label>
					<div class="control-inline">
						<#form:input path="companySimpleName" maxlength="20" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('客户类型')}：</label>
					<div class="control-inline width-120">
						<#form:select path="customType" dictType="st_custom_type" blankOption="true" class="form-control"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('客户等级')}：</label>
					<div class="control-inline width-120">
						<#form:select path="customLevel" dictType="st_custom_level" blankOption="true" class="form-control"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('业务员编码')}：</label>
					<div class="control-inline">
						<#form:input path="businessManCode" maxlength="20" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('业务员')}：</label>
					<div class="control-inline">
						<#form:input path="businessMan" maxlength="5" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('收款账期')}：</label>
					<div class="control-inline">
						<#form:input path="receiptTime" maxlength="36" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('默认税率')}：</label>
					<div class="control-inline">
						<#form:input path="defaultRate" maxlength="36" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('默认币别')}：</label>
					<div class="control-inline width-120">
						<#form:select path="moneyType" dictType="st_money_type" blankOption="true" class="form-control"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('结算方式')}：</label>
					<div class="control-inline width-120">
						<#form:select path="calcType" dictType="st_custom_calc_type" blankOption="true" class="form-control"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('纳税识别号')}：</label>
					<div class="control-inline">
						<#form:input path="rateCode" maxlength="20" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('开户银行')}：</label>
					<div class="control-inline">
						<#form:input path="bankName" maxlength="20" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('银行账号')}：</label>
					<div class="control-inline">
						<#form:input path="bankCode" maxlength="20" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('地址')}：</label>
					<div class="control-inline">
						<#form:input path="address" maxlength="20" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('信用额度')}：</label>
					<div class="control-inline">
						<#form:input path="creditNumber" maxlength="2" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('有效')}：</label>
					<div class="control-inline width-120">
						<#form:select path="effect" dictType="st_effect" blankOption="true" class="form-control"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('备注信息')}：</label>
					<div class="control-inline">
						<#form:input path="remarks" maxlength="500" class="form-control width-120"/>
					</div>
				</div>
				<div class="form-group">
					<button type="submit" class="btn btn-primary btn-sm">${text('查询')}</button>
					<button type="reset" class="btn btn-default btn-sm">${text('重置')}</button>
				</div>
			</#form:form>
			<table id="dataGrid"></table>
			<div id="dataGridPage"></div>
		</div>
	</div>
</div>
<% } %>
<script>
// 初始化DataGrid对象
$('#dataGrid').dataGrid({
	searchForm: $("#searchForm"),
	columnModel: [
		{header:'${text("客户编号")}', name:'customCode', index:'a.custom_code', width:150, align:"left", frozen:true, formatter: function(val, obj, row, act){
			return '<a href="${ctx}/st/stCustomRecord/form?id='+row.id+'" class="btnList" data-title="${text("编辑客户档案")}">'+(val||row.id)+'</a>';
		}},
		{header:'${text("全称")}', name:'companyFullName', index:'a.company_full_name', width:150, align:"left"},
		{header:'${text("简称")}', name:'companySimpleName', index:'a.company_simple_name', width:150, align:"left"},
		{header:'${text("客户类型")}', name:'customType', index:'a.custom_type', width:150, align:"center", formatter: function(val, obj, row, act){
			return js.getDictLabel(${@DictUtils.getDictListJson('st_custom_type')}, val, '${text("未知")}', true);
		}},
		{header:'${text("客户等级")}', name:'customLevel', index:'a.custom_level', width:150, align:"center", formatter: function(val, obj, row, act){
			return js.getDictLabel(${@DictUtils.getDictListJson('st_custom_level')}, val, '${text("未知")}', true);
		}},
		{header:'${text("业务员编码")}', name:'businessManCode', index:'a.business_man_code', width:150, align:"left"},
		{header:'${text("业务员")}', name:'businessMan', index:'a.business_man', width:150, align:"left"},
		{header:'${text("收款账期")}', name:'receiptTime', index:'a.receipt_time', width:150, align:"left"},
		{header:'${text("默认税率")}', name:'defaultRate', index:'a.default_rate', width:150, align:"left"},
		{header:'${text("默认币别")}', name:'moneyType', index:'a.money_type', width:150, align:"center", formatter: function(val, obj, row, act){
			return js.getDictLabel(${@DictUtils.getDictListJson('st_money_type')}, val, '${text("未知")}', true);
		}},
		{header:'${text("结算方式")}', name:'calcType', index:'a.calc_type', width:150, align:"center", formatter: function(val, obj, row, act){
			return js.getDictLabel(${@DictUtils.getDictListJson('st_custom_calc_type')}, val, '${text("未知")}', true);
		}},
		{header:'${text("纳税识别号")}', name:'rateCode', index:'a.rate_code', width:150, align:"left"},
		{header:'${text("开户银行")}', name:'bankName', index:'a.bank_name', width:150, align:"left"},
		{header:'${text("银行账号")}', name:'bankCode', index:'a.bank_code', width:150, align:"left"},
		{header:'${text("地址")}', name:'address', index:'a.address', width:150, align:"left"},
		{header:'${text("信用额度")}', name:'creditNumber', index:'a.credit_number', width:150, align:"center"},
		{header:'${text("有效")}', name:'effect', index:'a.effect', width:150, align:"center", formatter: function(val, obj, row, act){
			return js.getDictLabel(${@DictUtils.getDictListJson('st_effect')}, val, '${text("未知")}', true);
		}},
		{header:'${text("更新时间")}', name:'updateDate', index:'a.update_date', width:150, align:"center"},
		{header:'${text("备注信息")}', name:'remarks', index:'a.remarks', width:150, align:"left"},
		{header:'${text("操作")}', name:'actions', width:120, sortable:false, title:false, formatter: function(val, obj, row, act){
			var actions = [];
			<% if(hasPermi('st:stCustomRecord:edit')){ %>
				actions.push('<a href="${ctx}/st/stCustomRecord/form?id='+row.id+'" class="btnList" title="${text("编辑客户档案")}"><i class="fa fa-pencil"></i></a>&nbsp;');
				actions.push('<a href="${ctx}/st/stCustomRecord/delete?id='+row.id+'" class="btnList" title="${text("删除客户档案")}" data-confirm="${text("确认要删除该客户档案吗？")}"><i class="fa fa-trash-o"></i></a>&nbsp;');
			<% } %>
			return actions.join('');
		}}
	],
	// 加载成功后执行事件
	ajaxSuccess: function(data){
		
	}
});
</script>